//
//  EFADevMapTCell.m
//  efairy
//
//  Created by XiangDongMBP on 2017/7/12.
//  Copyright © 2017年 East. All rights reserved.
//

#import "EFADevMapTCell.h"
#import "EFAModel.h"

@implementation EFADevMapTCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    [self.naviBtn addTarget:self action:@selector(naviBtnTapped:) forControlEvents:UIControlEventTouchUpInside];
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)naviBtnTapped:(UIButton *)btn {
    if ([self.delegate respondsToSelector:@selector(devMapTCell:naviBtnTapped:)]) {
        [self.delegate devMapTCell:self naviBtnTapped:btn];
    }
}

- (void)configViewWithEFADeviceListItem:(DeviceListItem *)item {
//    UIImage *img = [UIImage imageNamed:item.listImgName];
    switch (item.efairydevice_alarm_id) {
        case 0:
            [self.iconBtn setImage:[UIImage imageNamed:@"icon_dev_lixian2"] forState:UIControlStateNormal];
            break;
        case 1:
            [self.iconBtn setImage:[UIImage imageNamed:@"icon_map_address_red2"] forState:UIControlStateNormal];
            break;
        case 2:
            [self.iconBtn setImage:[UIImage imageNamed:@"icon_map_address_yellow2"] forState:UIControlStateNormal];
            break;
        case 3:
            [self.iconBtn setImage:[UIImage imageNamed:@"icon_dev_guzhang2"] forState:UIControlStateNormal];
            break;
        case 6:
            [self.iconBtn setImage:[UIImage imageNamed:@"icon_map_address_green2"] forState:UIControlStateNormal];
            break;
        default:
            break;
    }
    
    self.nameLabel.text = item.efairydevice_name;
    self.addressLabel.text = item.efairydevice_address;
}

@end


@implementation EFADevMapTCell (ProjectRelative)

- (void)configViewWithPjtListItem:(EFAPjtListItem *)item {
    self.nameLabel.text = item.efairyproject_name;
    self.addressLabel.text = item.efairyproject_address;
}

@end
